﻿
function fnRunAction(entity, action, para, callback) {
    
}

function fnRunProc3(procName, para) {
    var _Data = null;
    $.ajax({
        type: "GET",
        url: "/ExtendPage/action/dataaction.aspx",
        data: { action: "runProc", entity: "proc", procName: procName, parameters: para, r: Math.random() },
        async: false,
        success: function (data) {
            _Data = eval("(" + data + ")");
        },
        error: function (e) {
            alert(e.Error);
            return;
        }
    }
    );
    return _Data;
}

/* --------------------------------------------------
//
// 说明    :用于前端调用存储过程
// procName:存储过程名
// para    :参数值以，分隔的字符串！"1,2"
// callback:回调方法,用于执行后，自行处理相关数据
//
----------------------------------------------------*/
function fnRunProc(procName,para,callback) {
    var _Data = null;
    $.ajax({
        type: "GET",
        url: "/ExtendPage/action/dataaction.aspx",
        data: { action: "runProc", entity: "proc", procName: procName, parameters: para ,r:Math.random()},
        async: false,
        success: function (data) {
            _Data = eval("(" + data + ")");
            if (typeof (callback) == "function") {
                callback(_Data);
            }
            else {
                if (_Data.stuats == 1) {
                    if (typeof (_Data.returnValue) == "undefined") {
                        alert("执行成功");
                    } else {
                        alert("执行结果:" + _Data.returnValue);
                    }
                    //alert("执行成功");
                }
                else {
                    alert("执行失败:" + _Data.msg);
                }
            }
        },
        error: function (e) {
            alert(e.Error);
            return;
        }
    }
    );
    return _Data;
}

/* --------------------------------------------------
//
// 说明    :用于前端调用存储程过
// procName:存储过程名
// para    :参数值以，分隔的字符串！"1,2"
// callback:回调方法,用于执行后，返回查询数据
//
----------------------------------------------------*/
function fnRunProc2(procName, para, callback) {
    var _Data = null;
    $.ajax({
        type: "GET",
        url: "/ExtendPage/action/dataaction.aspx",
        data: { action: "runProc", entity: "proc2", procName: procName, parameters: para, r: Math.random() },
        async: false,
        success: function (data) {  
           // debugger
            _Data = eval("(" + data + ")");
            if (typeof (callback) == "function") {
                callback(_Data);
                return;
            }
            else {
                if (_Data.stuats == 1) {
                    alert("执行成功");
                }
                else {
                    alert("执行失败:" + _Data.msg);
                }
            }
        },
        error: function (e) {
            alert(e.Error);
            return null;
        }
    }
    );
    return _Data;
}





